package org.whuims.pois.model;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;

/**
 * Created by zhongwei on 2014/5/16.
 */
@Entity
@javax.persistence.Table(name = "user")
public class User {
    private long id;
    private String user;
    private String password;
    private Integer level;
    private String privileges;
    private Long topicid;

    @Id
    @Column(name = "id")
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    @Basic
    @Column(name = "user")
    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    @Basic
    @Column(name = "password")
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Basic
    @Column(name = "level")
    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    @Basic
    @Column(name = "privileges")
    public String getPrivileges() {
        return privileges;
    }

    public void setPrivileges(String privileges) {
        this.privileges = privileges;
    }

    @Basic
    @Column(name = "topicid")
    public Long getTopicid() {
        return topicid;
    }

    public void setTopicid(Long topicid) {
        this.topicid = topicid;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        User user1 = (User) o;

        if (id != user1.id) return false;
        if (level != null ? !level.equals(user1.level) : user1.level != null) return false;
        if (password != null ? !password.equals(user1.password) : user1.password != null) return false;
        if (privileges != null ? !privileges.equals(user1.privileges) : user1.privileges != null) return false;
        if (topicid != null ? !topicid.equals(user1.topicid) : user1.topicid != null) return false;
        if (user != null ? !user.equals(user1.user) : user1.user != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = (int) (id ^ (id >>> 32));
        result = 31 * result + (user != null ? user.hashCode() : 0);
        result = 31 * result + (password != null ? password.hashCode() : 0);
        result = 31 * result + (level != null ? level.hashCode() : 0);
        result = 31 * result + (privileges != null ? privileges.hashCode() : 0);
        result = 31 * result + (topicid != null ? topicid.hashCode() : 0);
        return result;
    }
}
